package com.atguigu.zy.interview.jvm.gc;

import java.util.Random;

/**
 * @author Jungle
 * @create 2022-09-05 17:15
 * -Xms20m -Xmx20m -XX:+PrintGCDetails -XX:+UseG1GC
 */
public class G1Demo {
    public static void main(String[] args) {
        String str = "atguigu";
        try {
            while (true) {
                str += str + new Random().nextInt(77777777) + new Random().nextInt(88888888);
                //加入常量池返回
                str.intern();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
